home *** CD-ROM | disk | FTP | other *** search
/ Amiga Tools 3 / Amiga Tools 3.iso / programming / colpectius1 / explode.amos / explode.amosSourceCode
AMOS Source Code  |  1995-09-07  |  1KB  |  53 lines

  1. ' Explosion
  2. ' ~~~~~~~~~
  3. ' by Ben Wyatt, bwyatt@paston.co.uk
  4.  
  5. ' Creates an explosion effect which is actually quite good :-) but slow :-(
  6. ' so compile it for that extra burst of speed :) 
  7.  
  8. Set Buffer 50
  9. Degree 
  10.  
  11. Put Key "30"
  12. Input "Particles:";MXPART
  13. Dec MXPART
  14.  
  15. ' A pal/ntsc screen
  16. Screen Open 0,320,256+56*Ntsc,16,Lowres
  17. Screen Display 0,128,37,320,256
  18. Flash Off : Curs Off : Cls 0
  19. ' Get those lovely shades of red and yellow
  20. For N=0 To 7
  21.    Colour N,(N*2)*256 : Colour N+8,256*14+(N*2)*16
  22. Next N
  23.  
  24. Dim X(MXPART),Y(MXPART),C(MXPART),XSP(MXPART),YSP(MXPART),SIZE(MXPART)
  25.  
  26. ' Precalc loads of stuff 
  27. For N=0 To MXPART
  28.    ANG=Rnd(359) : SPD=Rnd(8)
  29.    X(N)=160+Sin(ANG)*SPD : Y(N)=96+Cos(ANG)*SPD
  30.    C(N)=12+Rnd(3)
  31.    XSP(N)=Rnd(10)-5 : YSP(N)=-Rnd(20)
  32. Next N
  33.  
  34. Double Buffer : Autoback 0
  35.  
  36. Repeat 
  37.    CNT=MXPART
  38.    For N=0 To MXPART
  39.       Add X(N),XSP(N)/4 : Add Y(N),YSP(N)/8
  40.       Inc YSP(N)
  41.       If Rnd(2)=1 and C(N)>1 : Dec C(N) : End If 
  42.       ST=3+Rnd(3)
  43.       For S=1 To C(N) Step 1
  44.          ' Turbo/AMCAF users can rem out the next line and unrem the one after
  45.          Ink S : Circle X(N),Y(N),(C(N)-S)/ST+1
  46.          'Fcircle X(N),Y(N),(C(N)-S)/ST+1,S   
  47.       Next S
  48.       If C(N)<=1 : Dec CNT : End If 
  49.    Next N
  50.    Wait Vbl : Screen Swap : Cls 0
  51. Until Mouse Key>0 or CNT=-1
  52.  
  53. Edit